<?php
namespace App\Models;

/**
 * 会员转账日志类
 */
class MTransferLog extends BaseModel
{
    public $table = "transfer_logs";

    /**
     * 记录一条转账日志
     * $me = 我的对象
     * $accept = 接收人对象
     * $wallet = 钱包类型
     * $money = 转账金额
     */
    public static function log($me, $accept, $wallet, $money)
    {

        $log = new MTransferLog();
        $log->no = onlyNo();
        $log->uid = $me->id;
        $log->username = $me->username;
        $log->wallet = $wallet;
        $log->accept_id = $accept->id;
        $log->accept_uname = $accept->username;
        $log->money = $money;
        $log->time = time();

        return $log->save();
    }
}